using ApprovalTests;
using ApprovalTests.Reporters;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace SmallBasicFun.Tests.TicTacToe
{
	[TestClass]
	
	public class TicTacToeTest
	{
		[TestMethod]
		public void TestGame()
		{
			SmallBasicFun.TicTacToe.TurnForPlayerX += PlayerX;
			SmallBasicFun.TicTacToe.TurnForPlayerO += PlayerX;
			SmallBasicFun.TicTacToe.SetAnimationDelay(0);

			SmallBasicFun.TicTacToe.Start();
			ApprovalHelper.ApproveProgramWindow();
		}


		private static void PlayerX()
		{
			for (int square = 1; square < 9; square++)
			{
				if (SmallBasicFun.TicTacToe.IsEmpty(square))
				{
					SmallBasicFun.TicTacToe.PlayPiece(square);
					break;
				}
			}
		}
	}
}